<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>前言 | 清风随笔</title>
    <meta name="generator" content="VuePress 1.7.1">
    <link rel="icon" href="/docs/assets/img/favicon.ico">
    <meta name="description" content="清风随笔">
    <meta rel="author" content="清风随笔">
    <meta rel="keywords" content="前端笔记，清风随笔">
    <link rel="preload" href="/docs/assets/css/0.styles.444b3866.css" as="style"><link rel="preload" href="/docs/assets/js/app.9a1ea3d7.js" as="script"><link rel="preload" href="/docs/assets/js/2.b157a060.js" as="script"><link rel="preload" href="/docs/assets/js/12.c2bc9913.js" as="script"><link rel="prefetch" href="/docs/assets/js/10.22d7ac9e.js"><link rel="prefetch" href="/docs/assets/js/11.213666d1.js"><link rel="prefetch" href="/docs/assets/js/13.b6f5507a.js"><link rel="prefetch" href="/docs/assets/js/14.691b0567.js"><link rel="prefetch" href="/docs/assets/js/15.6390a7cc.js"><link rel="prefetch" href="/docs/assets/js/16.87305a0e.js"><link rel="prefetch" href="/docs/assets/js/17.72be41e6.js"><link rel="prefetch" href="/docs/assets/js/18.abea1bb2.js"><link rel="prefetch" href="/docs/assets/js/19.6d43f402.js"><link rel="prefetch" href="/docs/assets/js/20.5a22e6b1.js"><link rel="prefetch" href="/docs/assets/js/21.3ed6dff5.js"><link rel="prefetch" href="/docs/assets/js/22.28f18616.js"><link rel="prefetch" href="/docs/assets/js/23.ebe08f15.js"><link rel="prefetch" href="/docs/assets/js/24.1ec03719.js"><link rel="prefetch" href="/docs/assets/js/3.4bb508f8.js"><link rel="prefetch" href="/docs/assets/js/4.19f0a32d.js"><link rel="prefetch" href="/docs/assets/js/5.f96a32c3.js"><link rel="prefetch" href="/docs/assets/js/6.b5f8c138.js"><link rel="prefetch" href="/docs/assets/js/7.fde78f5d.js"><link rel="prefetch" href="/docs/assets/js/8.9feb6e45.js"><link rel="prefetch" href="/docs/assets/js/9.1484fc35.js">
    <link rel="stylesheet" href="/docs/assets/css/0.styles.444b3866.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/docs/" class="home-link router-link-active"><img src="/docs/assets/img/logo.png" alt="清风随笔" class="logo"> <span class="site-name can-hide">清风随笔</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/docs/" class="nav-link">主页</a></div><div class="nav-item"><a href="/docs/pages/c3cd55/" class="nav-link">Vue</a></div><div class="nav-item"><a href="/docs/pages/2b5650/" class="nav-link">JavaScript</a></div><div class="nav-item"><a href="/docs/pages/11e8fa/" class="nav-link">TypeScript</a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/docs/" class="nav-link">主页</a></div><div class="nav-item"><a href="/docs/pages/c3cd55/" class="nav-link">Vue</a></div><div class="nav-item"><a href="/docs/pages/2b5650/" class="nav-link">JavaScript</a></div><div class="nav-item"><a href="/docs/pages/11e8fa/" class="nav-link">TypeScript</a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>TypeScript基础</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>TypeScript面向对象</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/docs/pages/a930b4/" aria-current="page" class="active sidebar-link">前言</a></li><li><a href="/docs/pages/0bbed8/" class="sidebar-link">类 (class)</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/pages/0bbed8/#定义类" class="sidebar-link">定义类</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/pages/0bbed8/#示例" class="sidebar-link">示例</a></li></ul></li><li class="sidebar-sub-header"><a href="/docs/pages/0bbed8/#使用类" class="sidebar-link">使用类</a></li></ul></li><li><a href="/docs/pages/a2f5e6/" class="sidebar-link">面向对象的特点</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/pages/a2f5e6/#封装" class="sidebar-link">封装</a></li><li class="sidebar-sub-header"><a href="/docs/pages/a2f5e6/#继承" class="sidebar-link">继承</a></li></ul></li><li><a href="/docs/pages/ff09e5/" class="sidebar-link">接口 (Interface)</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/pages/ff09e5/#示例-检查对象类型" class="sidebar-link">示例（检查对象类型）</a></li><li class="sidebar-sub-header"><a href="/docs/pages/ff09e5/#示例-实现" class="sidebar-link">示例（实现）</a></li></ul></li><li><a href="/docs/pages/81236a/" class="sidebar-link">泛型 (Generic)</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/docs/pages/81236a/#介绍" class="sidebar-link">介绍</a></li><li class="sidebar-sub-header"><a href="/docs/pages/81236a/#使用泛型" class="sidebar-link">使用泛型</a></li></ul></li></ul></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-33863c7e><div class="articleInfo" data-v-33863c7e><ul class="breadcrumbs" data-v-33863c7e><li data-v-33863c7e><a href="/docs/" title="首页" class="iconfont icon-home router-link-active" data-v-33863c7e></a></li> <li data-v-33863c7e><a href="/docs/categories/?category=TypeScript" title="分类" data-v-33863c7e>TypeScript</a></li> <li data-v-33863c7e><a href="/docs/categories/?category=TypeScript%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1" title="分类" data-v-33863c7e>TypeScript面向对象</a></li> <!----></ul> <div class="info" data-v-33863c7e><!----> <div title="创建时间" class="date iconfont icon-riqi" data-v-33863c7e><a href="javascript:;" data-v-33863c7e>2020-12-23</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><!----> <h1><img src="">
          前言
        </h1> <!----> <div class="theme-vdoing-content content__default"><p>面向对象是程序中一个非常重要的思想，它被很多同学理解成了一个比较难，比较深奥的问题，其实不然。面向对象很简单，简而言之就是程序之中所有的操作都需要通过对象来完成。</p> <ul><li>举例来说：
<ul><li>操作浏览器要使用 window 对象</li> <li>操作网页要使用 document 对象</li> <li>操作控制台要使用 console 对象</li></ul></li></ul> <p>一切操作都要通过对象，也就是所谓的面向对象，那么对象到底是什么呢？这就要先说到程序是什么，计算机程序的本质就是对现实事物的抽象，抽象的反义词是具体，比如：照片是对一个具体的人的抽象，汽车模型是对具体汽车的抽象等等。程序也是对事物的抽象，在程序中我们可以表示一个人、一条狗、一把枪、一颗子弹等等所有的事物。一个事物到了程序中就变成了一个对象。</p> <p>在程序中所有的对象都被分成了两个部分数据和功能，以人为例，人的姓名、性别、年龄、身高、体重等属于数据，人可以说话、走路、吃饭、睡觉这些属于人的功能。数据在对象中被成为属性，而功能就被称为方法。所以简而言之，在程序中一切皆是对象。</p></div></div> <!----> <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">更新时间:</span> <span class="time">2020年12月23日星期三晚上11点26分</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/docs/pages/978d74/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">webpack打包TypeScript</div></a> <a href="/docs/pages/0bbed8/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">类 (class)</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/docs/pages/978d74/" class="prev">webpack打包TypeScript</a></span> <span class="next"><a href="/docs/pages/0bbed8/">类 (class)</a>→
      </span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/docs/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/docs/pages/81236a/"><div>泛型 (Generic)</div></a> <span>12-23</span></dt></dl><dl><dd>02</dd> <dt><a href="/docs/pages/ff09e5/"><div>接口 (Interface)</div></a> <span>12-23</span></dt></dl><dl><dd>03</dd> <dt><a href="/docs/pages/a2f5e6/"><div>面向对象的特点</div></a> <span>12-23</span></dt></dl> <dl><dd></dd> <dt><a href="/docs/archives/" class="more">更多文章&gt;</a></dt></dl></div></div></main></div> <div class="footer"><!----> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> <!----></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">跟随系统</li><li class="iconfont icon-rijianmoshi">浅色模式</li><li class="iconfont icon-yejianmoshi">深色模式</li><li class="iconfont icon-yuedu">阅读模式</li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><!----></div></div>
    <script src="/docs/assets/js/app.9a1ea3d7.js" defer></script><script src="/docs/assets/js/2.b157a060.js" defer></script><script src="/docs/assets/js/12.c2bc9913.js" defer></script>
  </body>
</html>